package com.kws.system.controller.merchant;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kws.common.core.domain.R;
import com.kws.system.domain.merchant.CreateMerchantSettlementRq;
import com.kws.system.domain.merchant.MerchantExamineRq;
import com.kws.system.domain.merchant.QueryMerchantSettlementRq;
import com.kws.system.domain.merchant.info.QueryMerchantExamineInfo;
import com.kws.system.domain.merchant.info.QueryMerchantSettlementInfo;
import com.kws.system.service.merchant.MerchantSettlementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <b>MerchantSettlementController</b>
 *
 * @description: MerchantSettlementController <br>
 * @date: 2024/12/5 10:16 <br>
 * @author: lhm <br>
 * @version: 1.0 <br>
 */

@Api(tags = "商家入驻")
@RestController
public class MerchantSettlementController {
    private static final Logger logger = LoggerFactory.getLogger(MerchantSettlementController.class);

    @Autowired
    private MerchantSettlementService merchantSettlementService;

    @ApiOperation("分页查询商家入驻申请列表")
    @PostMapping("/query/merchantSettlement/page")
    public R<Page<QueryMerchantSettlementInfo>> queryMerchantSettlementPage(@RequestBody QueryMerchantSettlementRq rq){
        Page<QueryMerchantSettlementInfo> pageInfo = merchantSettlementService.queryMerchantSettlementPage(rq);
        return R.ok(pageInfo);
    }

    @ApiOperation("根据商家ID查询商家详情")
    @GetMapping("/query/merchantSettlement/byId")
    public R<QueryMerchantExamineInfo> queryMerchantSettlementById(@RequestParam Long id){
        QueryMerchantExamineInfo info = merchantSettlementService.queryMerchantSettlementById(id);
        return R.ok(info);
    }

    @ApiOperation("根据商家ID删除商家")
    @GetMapping("/delete/merchantSettlement/byId")
    public R deleteMerchantSettlementById(@RequestParam Long id){
        boolean status = merchantSettlementService.deleteMerchantSettlementById(id);
        return R.ok(status);
    }

    @ApiOperation("商家入驻一审")
    @PostMapping("/merchantSettlement/firstInstance")
    public R firstInstance(@RequestBody MerchantExamineRq rq){
        boolean status = merchantSettlementService.firstInstance(rq);
        return R.ok(status);
    }

    @ApiOperation("商家入驻二审")
    @PostMapping("/merchantSettlement/secondInstance")
    public R secondInstance(@RequestBody MerchantExamineRq rq){
        boolean status = merchantSettlementService.secondInstance(rq);
        return R.ok(status);
    }

    @ApiOperation("新增商家入驻信息")
    @PostMapping("/create/merchantSettlement")
    public R createMerchantSettlement(@RequestBody CreateMerchantSettlementRq rq){
        boolean status = merchantSettlementService.createMerchantSettlement(rq);
        return R.ok(status);
    }
}
